@extends('admin.layouts.layout')
@section('content')
    <?php
    use App\Models\Enum\Judge;
    ?>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-title">
                <h5>修改核查</h5>
            </div>
            <div class="ibox-content">
                <a class="menuid btn btn-primary btn-sm" href="{{getBackUrl()}}">返回</a>
                <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                <form class="form-horizontal m-t-md" action="{{route('check.store')}}" method="post"
                      accept-charset="UTF-8" enctype="multipart/form-data">
                    <input type="hidden" name="goBackUrl" value="{{getBackUrl()}}"/>
                    <input type="hidden" name="start_time" value="{{request()->input('start_time')}}"/>
                    <input type="hidden" name="end_time" value="{{request()->input('end_time')}}"/>
                    <input type="hidden" name="game_id" value="{{request()->input('game_id')}}"/>
                    <input type="hidden" name="channel_id" value="{{request()->input('channel_id')}}"/>

                    {!! csrf_field() !!}
                    <div class="form-group">
                        <label class="col-sm-2 control-label">总收入(渠道)：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="income" value="{{old('income',0)}}"
                                   placeholder="">
                            @if ($errors->has('income'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('income')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">公司实收金额：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="real_income"
                                   value="{{old('real_income',0)}}" autocomplete="off">
                            @if ($errors->has('real_income'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('real_income')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">合同约定的结算时间：</label>
                        <div class="input-group col-sm-2">
                            <input type="text" class="form-control" name="contract_time"
                                   value="{{old('contract_time')}}" autocomplete="off">
                            @if ($errors->has('contract_time'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('contract_time')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分成类型：</label>
                        <div class="input-group col-sm-10">
                            <?php
                            use \App\Models\Enum\ShareRatioType;
                            $html = '';
                            $shareRatioType = ShareRatioType::getAll();

                            foreach ($shareRatioType as $key => $type) {
                                $check = '';
                                if (old('share_ratio_type') == $key) {
                                    $check = ' checked="checked" ';
                                }

                                $html .= <<<EOF
 <div class="col-sm-2" style="min-width: 20rem;">
     <label>&emsp;$type
            <input class="pull-left" type="radio" name="share_ratio_type" value="$key" $check/>
    </label>
</div>
EOF;
                            }
                            echo $html;
                            ?>
                            @if ($errors->has('share_ratio_type'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('share_ratio_type')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>



                    <div class="form-group">
                        <label class="col-sm-2 control-label">最小值：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="min_value[]" value="{{old('min_value.0')}}"
                                   placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">最大值：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="max_value[]" value="{{old('max_value.0')}}"
                                   placeholder="">
                            @if ($errors->has('max_value'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('max_value')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分成比例(巨枫)：</label>
                        <div class="input-group col-sm-2">
                            <div class="input-group">
                                <input type="number" class="form-control" name="self_share_ratio[]"
                                       value="{{old('self_share_ratio.0')}}" autocomplete="off" step="0.0001">
                                <span
                                        class="input-group-addon">%</span>
                            </div>
                            @if ($errors->has('self_share_ratio'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('self_share_ratio')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分成比例(渠道)：</label>
                        <div class="input-group col-sm-2">
                            <div class="input-group">
                                <input type="number" class="form-control" name="channel_share_ratio[]"
                                       value="{{old('channel_share_ratio.0')}}" autocomplete="off" step="0.0001">
                                <span
                                        class="input-group-addon">%</span>
                            </div>
                            @if ($errors->has('channel_share_ratio'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('channel_share_ratio')}}</span>
                            @endif
                        </div>
                    </div>



                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">最小值：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="min_value[]" value="{{old('min_value.1')}}"
                                   placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">最大值：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="max_value[]" value="{{old('max_value.1')}}"
                                   placeholder="">
                            @if ($errors->has('max_value'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('max_value')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分成比例(巨枫)：</label>
                        <div class="input-group col-sm-2">
                            <div class="input-group">
                                <input type="number" class="form-control" name="self_share_ratio[]"
                                       value="{{old('self_share_ratio.1')}}" autocomplete="off" step="0.0001">
                                <span
                                        class="input-group-addon">%</span>
                            </div>
                            @if ($errors->has('self_share_ratio'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('self_share_ratio')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分成比例(渠道)：</label>
                        <div class="input-group col-sm-2">
                            <div class="input-group">
                                <input type="number" class="form-control" name="channel_share_ratio[]"
                                       value="{{old('channel_share_ratio.1')}}" autocomplete="off" step="0.0001">
                                <span
                                        class="input-group-addon">%</span>
                            </div>
                            @if ($errors->has('channel_share_ratio'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('channel_share_ratio')}}</span>
                            @endif
                        </div>
                    </div>



                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">最小值：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="min_value[]" value="{{old('min_value.2')}}"
                                   placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">最大值：</label>
                        <div class="input-group col-sm-2">
                            <input type="number" class="form-control" name="max_value[]" value="{{old('max_value.2')}}"
                                   placeholder="">
                            @if ($errors->has('max_value'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('max_value')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分成比例(巨枫)：</label>
                        <div class="input-group col-sm-2">
                            <div class="input-group">
                                <input type="number" class="form-control" name="self_share_ratio[]"
                                       value="{{old('self_share_ratio.2')}}" autocomplete="off" step="0.0001">
                                <span
                                        class="input-group-addon">%</span>
                            </div>
                            @if ($errors->has('self_share_ratio'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('self_share_ratio')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分成比例(渠道)：</label>
                        <div class="input-group col-sm-2">
                            <div class="input-group">
                                <input type="number" class="form-control" name="channel_share_ratio[]"
                                       value="{{old('channel_share_ratio.2')}}" autocomplete="off" step="0.0001">
                                <span
                                        class="input-group-addon">%</span>
                            </div>
                            @if ($errors->has('channel_share_ratio'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('channel_share_ratio')}}</span>
                            @endif
                        </div>
                    </div>



                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商务确认：</label>
                        <div class="input-group col-sm-1">
                            <select class="form-control" name="business_confirm">
                                <option value="2" <?php if (old('business_confirm') == Judge::NO) echo 'selected="selected"';?>>
                                    <?php echo Judge::get(Judge::NO)?>
                                </option>
                                <option value="1" <?php if (old('business_confirm') == Judge::YES) echo 'selected="selected"';?>>
                                    <?php echo Judge::get(Judge::YES)?>
                                </option>
                            </select>
                            @if ($errors->has('business_confirm'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('business_confirm')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">财务开票确认：</label>
                        <div class="input-group col-sm-1">
                            <select class="form-control" name="receipt_confirm">
                                <option value="2" <?php if (old('receipt_confirm') == Judge::NO) echo 'selected="selected"';?>>
                                    <?php echo Judge::get(Judge::NO)?>
                                </option>
                                <option value="1" <?php if (old('receipt_confirm') == Judge::YES) echo 'selected="selected"';?>>
                                    <?php echo Judge::get(Judge::YES)?>
                                </option>
                            </select>
                            @if ($errors->has('receipt_confirm'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('receipt_confirm')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">财务到账确认：</label>
                        <div class="input-group col-sm-1">
                            <select class="form-control" name="arrive_confirm">
                                <option value="2" <?php if (old('arrive_confirm') == Judge::NO) echo 'selected="selected"';?>>
                                    <?php echo Judge::get(Judge::NO)?>
                                </option>
                                <option value="1" <?php if (old('arrive_confirm') == Judge::YES) echo 'selected="selected"';?>>
                                    <?php echo Judge::get(Judge::YES)?>
                                </option>
                            </select>
                            @if ($errors->has('arrive_confirm'))
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('arrive_confirm')}}</span>
                            @endif
                        </div>
                    </div>
                    <div class="hr-line-dashed m-t-sm m-b-sm"></div>
                    <div class="form-group">
                        <div class="col-sm-12 col-sm-offset-2">
                            <button class="btn btn-primary" type="submit"><i class="fa fa-check"></i>&nbsp;保 存</button>
                            　
                            <button class="btn btn-white" type="reset"><i class="fa fa-repeat"></i> 重 置</button>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </form>
            </div>
        </div>
    </div>
@endsection